#include "rule.hh"

Rule::Rule (const std::string name,
	    const std::string id)
  : name_ (name),
    id_ (id)
{}

Object*
Rule::make (Vector3f pos, Vector3f size, int player_id, std::string obj_type, int obj_type_id)
{
  Object* o = 0;

  std::cout << name_ << std::endl;
  //add correspondance table kept in a file
  int id = 0;
  if (name_ == "sphere")
    id = 0;
  if (name_ == "cube")
    id = 1;

  if (obj_type == "building")
    {
      b_ = new Building (id, pos, size, 500, obj_type_id, player_id);
      o = b_;
      is_building_ = true;
    }
  else if (obj_type == "unit")
    {
      u_ = new Unit (id, pos, size, 500, obj_type_id, player_id);
      o = u_;
      is_building_ = false;
    }
  else
    o = new Object (id, pos, size, player_id);

  return o;
}
